package com.ymatou.controller;

import com.alibaba.fastjson.JSONObject;

import com.ymatou.impl.AccountCallServiceV2;
import com.ymatou.pojo.AccountingBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;

@Controller
@ResponseBody
public class RequestController {

    @RequestMapping(value = "/requestAction/resetAccount", method = RequestMethod.POST)
    public AccountingBean resetAccount(@RequestBody JSONObject param) throws Exception {

        AccountCallServiceV2 accountCallService = new AccountCallServiceV2();
        String accountId = accountCallService.getAccountId(param.getLong("userId"));

        return accountCallService.resetAccount(accountId, BigDecimal.TEN, BigDecimal.ZERO);
    }
}
